package cloudgamemysql

import (
	"gorm.io/gorm"
	"time"
)

/*
  @author liubogeng
  @date   2024/8/5 12:47
*/

// CGUserGame 用户游戏表
type CGUserGame struct {
	ID            int64          `json:"id" gorm:"column:id;type:bigint;primaryKey;autoIncrement;comment:ID"`
	UserID        int64          `json:"user_id" gorm:"index;column:user_id;type:bigint;not null;default:0;comment:用户ID"`
	GameID        int64          `json:"game_id" gorm:"index;column:game_id;type:bigint;not null;default:0;comment:游戏ID"`
	OpenID        string         `json:"open_id" gorm:"column:open_id;type:varchar(500);unique;not null;default:'';comment:Open ID（某个游戏在该平台的用户的唯一存在标识）"`
	ZCAccount     string         `json:"zc_account" gorm:"column:zc_account;type:varchar(20);not null;default:'';comment:厂商侧存的@zc账号"`
	Status        int            `json:"status" gorm:"column:status;type:tinyint;default:0;not null;comment:0为正常 1为禁止"`
	LastLoginIP   string         `json:"last_login_ip" gorm:"column:last_login_ip;type:varchar(20);not null;default:'';comment:用户最后一次登录IP"`
	LastLoginTime time.Time      `json:"last_login_time" gorm:"column:last_login_time;type:datetime;default:null;comment:用户最后一次登录时间"`
	CreatedAt     time.Time      `json:"created_at" gorm:"column:created_at;type:datetime;comment:该条记录创建时间"`
	UpdatedAt     time.Time      `json:"updated_at" gorm:"column:updated_at;type:datetime;comment:该条记录修改时间"`
	DeletedAt     gorm.DeletedAt `json:"-" gorm:"index;type:datetime;comment:该条记录删除时间"`
}

func (CGUserGame) TableName() string {
	return "cg_user_game"
}
